<%@ page language="java" %>
<%@ page session="true" %>
<%@ page import="java.sql.*,java.io.*,java.util.Random"%>
 

<HEAD>


	<script LANGUAGE="Javascript" SRC="Images/validate.js"></script>


	<LINK href="styles.css" type="text/css" rel="stylesheet">

</HEAD>
<BODY class=Grad>
<h2 align=center>Update Contact Information</h2>

<%

	Connection con=null;
	ResultSet rs=null;
	Statement stmt=null;
	String userid = request.getParameter("userid");
	String FirstName = request.getParameter("FirstName");	
	String LastName = request.getParameter("LastName");	
	String Email = request.getParameter("Email");	
	String ContactNumber = request.getParameter("ContactNumber");	
	String CurrentLocation = request.getParameter("CurrentLocation");	
	String Address = request.getParameter("Address");	
	try{
			
			/* Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
			con = DriverManager.getConnection("jdbc:odbc:JobPortal","root",""); */


			Class.forName("com.mysql.jdbc.Driver");
			con = DriverManager.getConnection("jdbc:mysql://localhost:3306/jobmiller","root","root");

			stmt =  con.createStatement();
	
			
			String Query = "Update contactinformation SET FirstName='"+FirstName+"', LastName='"+LastName+"' ,Email='"+Email+"', ContactNumber='"+ContactNumber+"' , CurrentLocation='"+CurrentLocation+"',Address='"+Address+"' where userid='"+userid+"'";
			System.out.println(Query);
			int result = stmt.executeUpdate(Query);
			if( result > 0)	{
				%><h3 align=center>Inserted into database sucessfully</h3><%
			}
			else{
				%><h3 align=center>Error in updating..please try again</h3><% 
			}
			stmt.close();
			con.close();
		}catch(Exception e){
			stmt.close();
			con.close();
			%><%=e%><%
		}
	
%>
</BODY>


